//
//  DataTableViewCell.swift
//  BusinessIOS
//
//  Created by Rain on 2018/11/9.
//  Copyright © 2018 XingJian Li. All rights reserved.
//

import UIKit

class DataTableViewCell: UITableViewCell {
    
    var bgView : UIView!

    var nameLabel : UILabel!
    
    
    var imageview : UIImageView!
    
    required init?(coder aDecoder: NSCoder) {
        
        super.init(coder: aDecoder)
        
    }
    
    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        self.lauoutUI()
        
    }
        
    
        func lauoutUI() {
        
            self.bgView = UIView()
            self.bgView.backgroundColor = UIColor.white
            self.contentView.addSubview(self.bgView)
        
        
        self.nameLabel = UILabel()
        self.nameLabel.text = "招商信息表格.doc"
        self.nameLabel.textAlignment = .left
        self.nameLabel.backgroundColor = UIColor.red
        self.nameLabel.font = UIFont.systemFont(ofSize:14)//一般方法
        self.nameLabel.backgroundColor = UIColor.groupTableViewBackground
        self.bgView.addSubview(self.nameLabel)
        
        
        
        self.imageview = UIImageView()
        
            
            self.imageview.image = UIImage.init(named: "down")
        self.bgView.addSubview(self.imageview)
        
     
        
        
        self.layoutView()
        
        
    }
    
    func layoutView() {
        
        self.bgView.snp.makeConstraints { (make) in
            make.top.equalTo(self.snp.top).offset(0)
            make.left.equalTo(self.snp.left).offset(0)
            make.right.equalTo(self.snp.right).offset(0)
            make.bottom.equalTo(self.snp.bottom).offset(0)
        }
        
        
        self.nameLabel.snp.makeConstraints { (make) in
            make.top.equalTo(self.bgView.snp.top).offset(5)
            make.left.equalTo(self.bgView.snp.left).offset(10)
            make.right.equalTo(self.bgView.right).offset(-10)
             make.bottom.equalTo(self.snp.bottom).offset(-5)
        }
        
        self.imageview.snp.makeConstraints { (make) in
            make.top.equalTo(self.bgView.snp.top).offset(20)
            
            make.right.equalTo(self.bgView.snp.right).offset(-10)
            make.height.equalTo(20)
            make.width.equalTo(20)
        }
        
        
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

}
